<%@ page contentType="text/html;charset=utf-8" %>
<%@ page import="java.util.*" %>
<%@ page import="java.io.*" %>
<%@ page import="jsp.util.ConnectionContext" %>
<%@ page import="java.sql.*" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
	<link rel=stylesheet href="form.css" type="text/css">
</head>
<body>

<div id="wrapper" style="border:1px solid #696">
	<jsp:include page="Menubar.jsp" flush="false"/>
 
 <center>
<p></p> 
<font size='3'><b> Q & A</b></font>
<p></p>             
</center>

<TABLE border="0" width="600" cellpadding="2" cellspacing="2" align="center">
	<TR>
      		<TD>
         		<hr size='1' noshade>
      		</TD>
	</TR>
</TABLE>

	<%
	try{
		
	Connection conn = ConnectionContext.getConnection();
	Statement stmt = conn.createStatement();
	String getnumbering=request.getParameter("numbering");

	String sql_content="select *from studentQ where numbering='"+getnumbering+"'"; 
		
	ResultSet rs = stmt.executeQuery(sql_content);
	
	while(rs.next()){
		
		int count=rs.getInt("count");
%>

<form action="QandAModify_Process.jsp" method="post" >

	<input type="hidden" name="hiddenvalue" value="<%=getnumbering%>">

	 	<TABLE border="0" width="600" cellpadding="2" cellspacing="2" align="center">
 		<tr>
 			<TD width="100" bgcolor="cccccc" align=center><font size="2">Title</font></td>
 			<td colspan="3"><input type="text" name="title" value="<%=rs.getString("title")%>"></td>
 		</tr>
 		
 		<tr>
 			<TD width="100" bgcolor="cccccc" align=center><font size="2">Writer</font></td>
 			<TD><%=rs.getString("studName")%></td>
 		</tr>
 		<tr>
 			<TD width="100" bgcolor="cccccc" align=center><font size="2">Date</font></td>
 			<TD><%=rs.getDate("registerDate")%></td>
 			<TD width="100" bgcolor="cccccc" align=center><font size="2">Count</font></td>
 			<TD><%=count%></td>
 		</tr>
 		<tr>
      		<TD colspan='4'>
         		<hr size='1' noshade>
      		</TD>
		</tr>
 		<tr>
 			<TD width="100" bgcolor="cccccc" align=center><font size="2">Content</font></td>
  			<td colspan="3"><textarea cols='70' rows='15' name='contents'><%=rs.getString("content") %></textarea></td>
 		</tr>
 		
 	<% 
		String filepath=rs.getString("filepath");
	
		if(filepath != null)
		{
	%>
 		
 		<tr>
 			<TD width="100" bgcolor="cccccc" align="center"><font size='2'>Photo</font></td>
 			<td colspan="3"><img src="<%=filepath%>" border="0" width='600' height='400'></td>
 		</tr>
 		<% 
 		}
		
		%>
		
		<tr >
 			<TD width="100" bgcolor="cccccc" align="center"><font size='2'>Reply</font></td>
 			<td><textarea cols="60" rows="2" readonly></textarea></td>
 			<td><input type="button" value="regist" name="BTNreply">
 			</td>
 		</tr>
 	</table>
 	
 	<%
 	rs.close();
 		} 
		
	}catch(SQLException ex){ }
	
 	%>
 	<input type="submit" value="수정완료">
 	
 </form>
 
 
 </div>

</body>
</html>